n = int(input())
b = list(map(int, input().split()))
a = [[(i*j)%n for i in range(1,n+1)] for j in range(1,n+1)]
for i in range(n):
if(b[i]!=a[i][i]):
x = b[i]-a[i][i]
for j in range(n):
a[i][j] = (a[i][j]+x)%n
print(*a[i])
#include <bits/stdc++.h>
#include <unordered_map>
#include <chrono>
#define endl '\n'
using namespace std;
const int N = 1e6 + 10, inf = 0x3f3f3f3f, mod = 998244353;
const double eps = 1e-2;
const long double pi = acos(-1);
typedef long long LL;
typedef pair<LL, LL> PII;
typedef long double LD;
typedef unsigned long long ull;
const ull mask = std::chrono::steady_clock::now().time_since_epoch().count();
int b[N];
int a[500][500];
int main() {
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int t;
//cin >> t;
t = 1;
while (t--) {
int n;
cin >> n;
for (int i = 1; i <= n; i++) cin >> b[i];
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
cout << ((i * j + b[i] - i * i)%n+n)%n << ' ';
}
cout << endl;
}
}
return 0;
}
3. Longest Substring Without Repeating Characters | 1312. Minimum Insertion Steps to Make a String Palindrome |
1092. Shortest Common Supersequence | 1044. Longest Duplicate Substring |
1032. Stream of Characters | 987. Vertical Order Traversal of a Binary Tree |
952. Largest Component Size by Common Factor | 212. Word Search II |
174. Dungeon Game | 127. Word Ladder |
123. Best Time to Buy and Sell Stock III | 85. Maximal Rectangle |
84. Largest Rectangle in Histogram | 60. Permutation Sequence |
42. Trapping Rain Water | 32. Longest Valid Parentheses |
Cutting a material | Bubble Sort |
Number of triangles | AND path in a binary tree |
Factorial equations | Removal of vertices |
Happy segments | Cyclic shifts |
Zoos | Build a graph |
Almost correct bracket sequence | Count of integers |
Differences of the permutations | Doctor's Secret |